package com.bdqn.t320.ch12.service;

import com.bdqn.t320.ch12.repository.UserRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImp implements UserService {
    @Resource
    UserRepository userRepository;

//    @Override
//    public Page<User> findPageByMapaaaa(Map param, Pageable pageable) {
//        return userRepository.findAll(new Specification<User>() {
//            @Override
//            public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
//                List<Predicate> predicates = new ArrayList<>();
//                if (param.get("usrName") != null) { //动态 SQL
//                    predicates.add(cb.like(root.get("usrName"), "%" + param.get("usrName") + "%"));
//                }
//                if (param.get("roleId") != null) {
//                    predicates.add(cb.equal(root.get("usrRoleId"), param.get("roleId")));
//                }
//                return cb.and(predicates.toArray(new Predicate[predicates.size()]));
//            }
//        }, pageable);
//    }

}
